#ifndef COMPACT_H_
#define COMAPCT_H_

/**
 * manage comapction of data segment. Only  a single instance is required in a
 * environement  
 */ 
class Compact {

public:
    Compact(){}
    virtual ~Compact() {}

    //init compaction
    virtual DbStatus init() = 0;

    //start compact
    virtual void start() = 0;

    //stop compact
    virtual void stop(bool quit) = 0;

    //enable/disable throttling
    virtual void enableThrottling() = 0;
    virtual void disableThrottling() = 0;

    //is compact enabled or disabled
    virtual bool isEnabled() = 0;

    //process M Mega per N seconds
    virtual void setThrottling(uint32_t M, uint32_t N) = 0;
    
    //all segments have (actual data size / capacity ) < ratio will be compacted
    virtual void setValidDataRatio(double ratio) = 0;

    //get ratio
    virtual double getValidDataRatio() = 0;

    //notify to trigger compact thread
    virtual void notify() = 0;

    //nanoseconds for writing to wait
    virtual uint64_t timeToWait() = 0;
};

#endif
